-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Say that pub(in path)
can't depend on use
statements
#1559
Conversation
2cf1f64
to
366c0f5
Compare
Sorry, saying "canonical path" isn't right because things like So instead, just say explicitly that using names from |
pub(in path)
must use a canonical pathpub(in path)
can't depend on use
statements
@petrochenkov: We talked about this in the lang-docs call today, and we were uncertain whether or not this behavior is intentional, or what the history is here. What do you think? This is about cases like this: mod m {
use crate::m as n;
pub(in self::n) fn f() {}
//~^ ERROR failed to resolve: could not find `n` in `self`
} [Edit: Thanks to @mattheww for a fix to this example.] |
This comment was marked as resolved.
This comment was marked as resolved.
I explained the situation in rust-lang/rust#109657 (comment). Basically supporting arbitrary paths in I suspect that in practice imports may be supported in some cases, if they are ready early enough, but it's not guaranteed. |
Example of mod a {
macro_rules! delay {
() => { pub(in crate::b) struct S; }
}
delay!();
}
use a as b; I wouldn't want to guarantee that this ^^^ works. |
Thanks @petrochenkov for that background. Wild example there; thanks for sharing that. Given that, the change seems fine. Thanks @mattheww. |
Update books ## rust-lang/book 4 commits in 04bc1396bb857f35b5dda1d773c9571e1f253304..e7d217be2a75ef1753f0988d6ccaba4d7e376259 2024-08-14 01:19:47 UTC to 2024-08-13 16:51:00 UTC - Backport/forward port ch12 (rust-lang/book#4008) - Found some more things to fix in ch7; I forgot to update the snapshot (rust-lang/book#4007) - Remove redundant sentence. Send to nostarch (rust-lang/book#4006) - Fix: typo (rust-lang/book#4003) ## rust-lang/edition-guide 5 commits in aeeb287d41a0332c210da122bea8e0e91844ab3e..eeba2cb9c37ab74118a4fb5e5233f7397e4a91f8 2024-08-19 23:28:06 UTC to 2024-08-15 15:12:33 UTC - 2024: Add rustdoc combined doctests (rust-lang/edition-guide#320) - Update for unsafe attributes stabilization (rust-lang/edition-guide#319) - 2024: Add macro-fragment-specifiers. (rust-lang/edition-guide#312) - Fix deprecated_safe_2024 link (rust-lang/edition-guide#317) - Add 2024 unsafe functions (rust-lang/edition-guide#304) ## rust-embedded/book 1 commits in 019f3928d8b939ec71b63722dcc2e46330156441..ff5d61d56f11e1986bfa9652c6aff7731576c37d 2024-08-20 07:26:19 UTC to 2024-08-20 07:26:19 UTC - Use aligned address to demonstrate HardFault (rust-embedded/book#374) ## rust-lang/nomicon 1 commits in 6ecf95c5f2bfa0e6314dfe282bf775fd1405f7e9..14649f15d232d509478206ee9ed5105641aa60d0 2024-08-14 14:49:09 UTC to 2024-08-14 14:49:09 UTC - CI: Switch to merge queue (rust-lang/nomicon#459) ## rust-lang/reference 14 commits in 62cd0df95061ba0ac886333f5cd7f3012f149da1..0668397076da350c404dadcf07b6cbc433ad3743 2024-08-11 21:06:12 +0000 to 2024-08-27 21:47:20 +0000 - Update enum.md (rust-lang/reference#1354) - Be consistent about how "Edition differences" is capitalized (rust-lang/reference#1586) - Sync denied lints with upstream (rust-lang/reference#1589) - const_eval: update for const-fn float stabilization (rust-lang/reference#1566) - Add spec identifier syntax to destructors.md (rust-lang/reference#1571) - Say that `pub(in path)` can't depend on `use` statements (rust-lang/reference#1559) - bytes inside implicitly const-promoted expressions are immutable (rust-lang/reference#1554) - Tweak `repr(transparent)` to mention requiring *at most* one non-1-ZST (rust-lang/reference#1568) - operator expressions: add &raw (rust-lang/reference#1567) - Rewrite the automatic std link translation, and switch to automatic links (rust-lang/reference#1578) - Add some basic docs for unsafe attrs (rust-lang/reference#1539) - don't capitalize Undefined Behavior (rust-lang/reference#1575) - add the `const` operand to docs for inline assembly (rust-lang/reference#1556) - Typo: 'a' to 'an' in type-coercions.md (rust-lang/reference#1572) ## rust-lang/rust-by-example 1 commits in 8f94061936e492159f4f6c09c0f917a7521893ff..859786c5bc99301bbc22fc631a5c2b341860da08 2024-08-26 10:30:48 UTC to 2024-08-26 10:30:48 UTC - Update primitives.md with examples (rust-lang/rust-by-example#1878) ## rust-lang/rustc-dev-guide 7 commits in 43d83780db545a1ed6d45773312fc578987e3968..fa928a6d19e1666d8d811dfe3fd35cdad3b4e459 2024-08-26 14:46:50 UTC to 2024-08-12 21:07:49 UTC - Fix x.py reference (rust-lang/rustc-dev-guide#2049) - Update `stabilization_guide.md` (rust-lang/rustc-dev-guide#2034) - Explain the internal `#[rustc_*]` TEST attributes used for debugging and inside tests (rust-lang/rustc-dev-guide#2046) - missing char (rust-lang/rustc-dev-guide#2047) - Replace direct http links to rustc-dev-guide.rust-lang.org (rust-lang/rustc-dev-guide#2044) - Update index.html, 39. The MIR: fix typo (rust-lang/rustc-dev-guide#2043) - Update LLVM docs (rust-lang/rustc-dev-guide#2039)
Update books ## rust-lang/book 4 commits in 04bc1396bb857f35b5dda1d773c9571e1f253304..e7d217be2a75ef1753f0988d6ccaba4d7e376259 2024-08-14 01:19:47 UTC to 2024-08-13 16:51:00 UTC - Backport/forward port ch12 (rust-lang/book#4008) - Found some more things to fix in ch7; I forgot to update the snapshot (rust-lang/book#4007) - Remove redundant sentence. Send to nostarch (rust-lang/book#4006) - Fix: typo (rust-lang/book#4003) ## rust-lang/edition-guide 5 commits in aeeb287d41a0332c210da122bea8e0e91844ab3e..eeba2cb9c37ab74118a4fb5e5233f7397e4a91f8 2024-08-19 23:28:06 UTC to 2024-08-15 15:12:33 UTC - 2024: Add rustdoc combined doctests (rust-lang/edition-guide#320) - Update for unsafe attributes stabilization (rust-lang/edition-guide#319) - 2024: Add macro-fragment-specifiers. (rust-lang/edition-guide#312) - Fix deprecated_safe_2024 link (rust-lang/edition-guide#317) - Add 2024 unsafe functions (rust-lang/edition-guide#304) ## rust-embedded/book 1 commits in 019f3928d8b939ec71b63722dcc2e46330156441..ff5d61d56f11e1986bfa9652c6aff7731576c37d 2024-08-20 07:26:19 UTC to 2024-08-20 07:26:19 UTC - Use aligned address to demonstrate HardFault (rust-embedded/book#374) ## rust-lang/nomicon 1 commits in 6ecf95c5f2bfa0e6314dfe282bf775fd1405f7e9..14649f15d232d509478206ee9ed5105641aa60d0 2024-08-14 14:49:09 UTC to 2024-08-14 14:49:09 UTC - CI: Switch to merge queue (rust-lang/nomicon#459) ## rust-lang/reference 14 commits in 62cd0df95061ba0ac886333f5cd7f3012f149da1..0668397076da350c404dadcf07b6cbc433ad3743 2024-08-11 21:06:12 +0000 to 2024-08-27 21:47:20 +0000 - Update enum.md (rust-lang/reference#1354) - Be consistent about how "Edition differences" is capitalized (rust-lang/reference#1586) - Sync denied lints with upstream (rust-lang/reference#1589) - const_eval: update for const-fn float stabilization (rust-lang/reference#1566) - Add spec identifier syntax to destructors.md (rust-lang/reference#1571) - Say that `pub(in path)` can't depend on `use` statements (rust-lang/reference#1559) - bytes inside implicitly const-promoted expressions are immutable (rust-lang/reference#1554) - Tweak `repr(transparent)` to mention requiring *at most* one non-1-ZST (rust-lang/reference#1568) - operator expressions: add &raw (rust-lang/reference#1567) - Rewrite the automatic std link translation, and switch to automatic links (rust-lang/reference#1578) - Add some basic docs for unsafe attrs (rust-lang/reference#1539) - don't capitalize Undefined Behavior (rust-lang/reference#1575) - add the `const` operand to docs for inline assembly (rust-lang/reference#1556) - Typo: 'a' to 'an' in type-coercions.md (rust-lang/reference#1572) ## rust-lang/rust-by-example 1 commits in 8f94061936e492159f4f6c09c0f917a7521893ff..859786c5bc99301bbc22fc631a5c2b341860da08 2024-08-26 10:30:48 UTC to 2024-08-26 10:30:48 UTC - Update primitives.md with examples (rust-lang/rust-by-example#1878) ## rust-lang/rustc-dev-guide 7 commits in 43d83780db545a1ed6d45773312fc578987e3968..fa928a6d19e1666d8d811dfe3fd35cdad3b4e459 2024-08-26 14:46:50 UTC to 2024-08-12 21:07:49 UTC - Fix x.py reference (rust-lang/rustc-dev-guide#2049) - Update `stabilization_guide.md` (rust-lang/rustc-dev-guide#2034) - Explain the internal `#[rustc_*]` TEST attributes used for debugging and inside tests (rust-lang/rustc-dev-guide#2046) - missing char (rust-lang/rustc-dev-guide#2047) - Replace direct http links to rustc-dev-guide.rust-lang.org (rust-lang/rustc-dev-guide#2044) - Update index.html, 39. The MIR: fix typo (rust-lang/rustc-dev-guide#2043) - Update LLVM docs (rust-lang/rustc-dev-guide#2039)
Update books ## rust-lang/book 4 commits in 04bc1396bb857f35b5dda1d773c9571e1f253304..e7d217be2a75ef1753f0988d6ccaba4d7e376259 2024-08-14 01:19:47 UTC to 2024-08-13 16:51:00 UTC - Backport/forward port ch12 (rust-lang/book#4008) - Found some more things to fix in ch7; I forgot to update the snapshot (rust-lang/book#4007) - Remove redundant sentence. Send to nostarch (rust-lang/book#4006) - Fix: typo (rust-lang/book#4003) ## rust-lang/edition-guide 5 commits in aeeb287d41a0332c210da122bea8e0e91844ab3e..eeba2cb9c37ab74118a4fb5e5233f7397e4a91f8 2024-08-19 23:28:06 UTC to 2024-08-15 15:12:33 UTC - 2024: Add rustdoc combined doctests (rust-lang/edition-guide#320) - Update for unsafe attributes stabilization (rust-lang/edition-guide#319) - 2024: Add macro-fragment-specifiers. (rust-lang/edition-guide#312) - Fix deprecated_safe_2024 link (rust-lang/edition-guide#317) - Add 2024 unsafe functions (rust-lang/edition-guide#304) ## rust-embedded/book 1 commits in 019f3928d8b939ec71b63722dcc2e46330156441..ff5d61d56f11e1986bfa9652c6aff7731576c37d 2024-08-20 07:26:19 UTC to 2024-08-20 07:26:19 UTC - Use aligned address to demonstrate HardFault (rust-embedded/book#374) ## rust-lang/nomicon 1 commits in 6ecf95c5f2bfa0e6314dfe282bf775fd1405f7e9..14649f15d232d509478206ee9ed5105641aa60d0 2024-08-14 14:49:09 UTC to 2024-08-14 14:49:09 UTC - CI: Switch to merge queue (rust-lang/nomicon#459) ## rust-lang/reference 14 commits in 62cd0df95061ba0ac886333f5cd7f3012f149da1..0668397076da350c404dadcf07b6cbc433ad3743 2024-08-11 21:06:12 +0000 to 2024-08-27 21:47:20 +0000 - Update enum.md (rust-lang/reference#1354) - Be consistent about how "Edition differences" is capitalized (rust-lang/reference#1586) - Sync denied lints with upstream (rust-lang/reference#1589) - const_eval: update for const-fn float stabilization (rust-lang/reference#1566) - Add spec identifier syntax to destructors.md (rust-lang/reference#1571) - Say that `pub(in path)` can't depend on `use` statements (rust-lang/reference#1559) - bytes inside implicitly const-promoted expressions are immutable (rust-lang/reference#1554) - Tweak `repr(transparent)` to mention requiring *at most* one non-1-ZST (rust-lang/reference#1568) - operator expressions: add &raw (rust-lang/reference#1567) - Rewrite the automatic std link translation, and switch to automatic links (rust-lang/reference#1578) - Add some basic docs for unsafe attrs (rust-lang/reference#1539) - don't capitalize Undefined Behavior (rust-lang/reference#1575) - add the `const` operand to docs for inline assembly (rust-lang/reference#1556) - Typo: 'a' to 'an' in type-coercions.md (rust-lang/reference#1572) ## rust-lang/rust-by-example 1 commits in 8f94061936e492159f4f6c09c0f917a7521893ff..859786c5bc99301bbc22fc631a5c2b341860da08 2024-08-26 10:30:48 UTC to 2024-08-26 10:30:48 UTC - Update primitives.md with examples (rust-lang/rust-by-example#1878) ## rust-lang/rustc-dev-guide 7 commits in 43d83780db545a1ed6d45773312fc578987e3968..fa928a6d19e1666d8d811dfe3fd35cdad3b4e459 2024-08-26 14:46:50 UTC to 2024-08-12 21:07:49 UTC - Fix x.py reference (rust-lang/rustc-dev-guide#2049) - Update `stabilization_guide.md` (rust-lang/rustc-dev-guide#2034) - Explain the internal `#[rustc_*]` TEST attributes used for debugging and inside tests (rust-lang/rustc-dev-guide#2046) - missing char (rust-lang/rustc-dev-guide#2047) - Replace direct http links to rustc-dev-guide.rust-lang.org (rust-lang/rustc-dev-guide#2044) - Update index.html, 39. The MIR: fix typo (rust-lang/rustc-dev-guide#2043) - Update LLVM docs (rust-lang/rustc-dev-guide#2039)
Rollup merge of rust-lang#129617 - rustbot:docs-update, r=ehuss Update books ## rust-lang/book 4 commits in 04bc1396bb857f35b5dda1d773c9571e1f253304..e7d217be2a75ef1753f0988d6ccaba4d7e376259 2024-08-14 01:19:47 UTC to 2024-08-13 16:51:00 UTC - Backport/forward port ch12 (rust-lang/book#4008) - Found some more things to fix in ch7; I forgot to update the snapshot (rust-lang/book#4007) - Remove redundant sentence. Send to nostarch (rust-lang/book#4006) - Fix: typo (rust-lang/book#4003) ## rust-lang/edition-guide 5 commits in aeeb287d41a0332c210da122bea8e0e91844ab3e..eeba2cb9c37ab74118a4fb5e5233f7397e4a91f8 2024-08-19 23:28:06 UTC to 2024-08-15 15:12:33 UTC - 2024: Add rustdoc combined doctests (rust-lang/edition-guide#320) - Update for unsafe attributes stabilization (rust-lang/edition-guide#319) - 2024: Add macro-fragment-specifiers. (rust-lang/edition-guide#312) - Fix deprecated_safe_2024 link (rust-lang/edition-guide#317) - Add 2024 unsafe functions (rust-lang/edition-guide#304) ## rust-embedded/book 1 commits in 019f3928d8b939ec71b63722dcc2e46330156441..ff5d61d56f11e1986bfa9652c6aff7731576c37d 2024-08-20 07:26:19 UTC to 2024-08-20 07:26:19 UTC - Use aligned address to demonstrate HardFault (rust-embedded/book#374) ## rust-lang/nomicon 1 commits in 6ecf95c5f2bfa0e6314dfe282bf775fd1405f7e9..14649f15d232d509478206ee9ed5105641aa60d0 2024-08-14 14:49:09 UTC to 2024-08-14 14:49:09 UTC - CI: Switch to merge queue (rust-lang/nomicon#459) ## rust-lang/reference 14 commits in 62cd0df95061ba0ac886333f5cd7f3012f149da1..0668397076da350c404dadcf07b6cbc433ad3743 2024-08-11 21:06:12 +0000 to 2024-08-27 21:47:20 +0000 - Update enum.md (rust-lang/reference#1354) - Be consistent about how "Edition differences" is capitalized (rust-lang/reference#1586) - Sync denied lints with upstream (rust-lang/reference#1589) - const_eval: update for const-fn float stabilization (rust-lang/reference#1566) - Add spec identifier syntax to destructors.md (rust-lang/reference#1571) - Say that `pub(in path)` can't depend on `use` statements (rust-lang/reference#1559) - bytes inside implicitly const-promoted expressions are immutable (rust-lang/reference#1554) - Tweak `repr(transparent)` to mention requiring *at most* one non-1-ZST (rust-lang/reference#1568) - operator expressions: add &raw (rust-lang/reference#1567) - Rewrite the automatic std link translation, and switch to automatic links (rust-lang/reference#1578) - Add some basic docs for unsafe attrs (rust-lang/reference#1539) - don't capitalize Undefined Behavior (rust-lang/reference#1575) - add the `const` operand to docs for inline assembly (rust-lang/reference#1556) - Typo: 'a' to 'an' in type-coercions.md (rust-lang/reference#1572) ## rust-lang/rust-by-example 1 commits in 8f94061936e492159f4f6c09c0f917a7521893ff..859786c5bc99301bbc22fc631a5c2b341860da08 2024-08-26 10:30:48 UTC to 2024-08-26 10:30:48 UTC - Update primitives.md with examples (rust-lang/rust-by-example#1878) ## rust-lang/rustc-dev-guide 7 commits in 43d83780db545a1ed6d45773312fc578987e3968..fa928a6d19e1666d8d811dfe3fd35cdad3b4e459 2024-08-26 14:46:50 UTC to 2024-08-12 21:07:49 UTC - Fix x.py reference (rust-lang/rustc-dev-guide#2049) - Update `stabilization_guide.md` (rust-lang/rustc-dev-guide#2034) - Explain the internal `#[rustc_*]` TEST attributes used for debugging and inside tests (rust-lang/rustc-dev-guide#2046) - missing char (rust-lang/rustc-dev-guide#2047) - Replace direct http links to rustc-dev-guide.rust-lang.org (rust-lang/rustc-dev-guide#2044) - Update index.html, 39. The MIR: fix typo (rust-lang/rustc-dev-guide#2043) - Update LLVM docs (rust-lang/rustc-dev-guide#2039)
Update books ## rust-lang/book 4 commits in 04bc1396bb857f35b5dda1d773c9571e1f253304..e7d217be2a75ef1753f0988d6ccaba4d7e376259 2024-08-14 01:19:47 UTC to 2024-08-13 16:51:00 UTC - Backport/forward port ch12 (rust-lang/book#4008) - Found some more things to fix in ch7; I forgot to update the snapshot (rust-lang/book#4007) - Remove redundant sentence. Send to nostarch (rust-lang/book#4006) - Fix: typo (rust-lang/book#4003) ## rust-lang/edition-guide 5 commits in aeeb287d41a0332c210da122bea8e0e91844ab3e..eeba2cb9c37ab74118a4fb5e5233f7397e4a91f8 2024-08-19 23:28:06 UTC to 2024-08-15 15:12:33 UTC - 2024: Add rustdoc combined doctests (rust-lang/edition-guide#320) - Update for unsafe attributes stabilization (rust-lang/edition-guide#319) - 2024: Add macro-fragment-specifiers. (rust-lang/edition-guide#312) - Fix deprecated_safe_2024 link (rust-lang/edition-guide#317) - Add 2024 unsafe functions (rust-lang/edition-guide#304) ## rust-embedded/book 1 commits in 019f3928d8b939ec71b63722dcc2e46330156441..ff5d61d56f11e1986bfa9652c6aff7731576c37d 2024-08-20 07:26:19 UTC to 2024-08-20 07:26:19 UTC - Use aligned address to demonstrate HardFault (rust-embedded/book#374) ## rust-lang/nomicon 1 commits in 6ecf95c5f2bfa0e6314dfe282bf775fd1405f7e9..14649f15d232d509478206ee9ed5105641aa60d0 2024-08-14 14:49:09 UTC to 2024-08-14 14:49:09 UTC - CI: Switch to merge queue (rust-lang/nomicon#459) ## rust-lang/reference 14 commits in 62cd0df95061ba0ac886333f5cd7f3012f149da1..0668397076da350c404dadcf07b6cbc433ad3743 2024-08-11 21:06:12 +0000 to 2024-08-27 21:47:20 +0000 - Update enum.md (rust-lang/reference#1354) - Be consistent about how "Edition differences" is capitalized (rust-lang/reference#1586) - Sync denied lints with upstream (rust-lang/reference#1589) - const_eval: update for const-fn float stabilization (rust-lang/reference#1566) - Add spec identifier syntax to destructors.md (rust-lang/reference#1571) - Say that `pub(in path)` can't depend on `use` statements (rust-lang/reference#1559) - bytes inside implicitly const-promoted expressions are immutable (rust-lang/reference#1554) - Tweak `repr(transparent)` to mention requiring *at most* one non-1-ZST (rust-lang/reference#1568) - operator expressions: add &raw (rust-lang/reference#1567) - Rewrite the automatic std link translation, and switch to automatic links (rust-lang/reference#1578) - Add some basic docs for unsafe attrs (rust-lang/reference#1539) - don't capitalize Undefined Behavior (rust-lang/reference#1575) - add the `const` operand to docs for inline assembly (rust-lang/reference#1556) - Typo: 'a' to 'an' in type-coercions.md (rust-lang/reference#1572) ## rust-lang/rust-by-example 1 commits in 8f94061936e492159f4f6c09c0f917a7521893ff..859786c5bc99301bbc22fc631a5c2b341860da08 2024-08-26 10:30:48 UTC to 2024-08-26 10:30:48 UTC - Update primitives.md with examples (rust-lang/rust-by-example#1878) ## rust-lang/rustc-dev-guide 7 commits in 43d83780db545a1ed6d45773312fc578987e3968..fa928a6d19e1666d8d811dfe3fd35cdad3b4e459 2024-08-26 14:46:50 UTC to 2024-08-12 21:07:49 UTC - Fix x.py reference (rust-lang/rustc-dev-guide#2049) - Update `stabilization_guide.md` (rust-lang/rustc-dev-guide#2034) - Explain the internal `#[rustc_*]` TEST attributes used for debugging and inside tests (rust-lang/rustc-dev-guide#2046) - missing char (rust-lang/rustc-dev-guide#2047) - Replace direct http links to rustc-dev-guide.rust-lang.org (rust-lang/rustc-dev-guide#2044) - Update index.html, 39. The MIR: fix typo (rust-lang/rustc-dev-guide#2043) - Update LLVM docs (rust-lang/rustc-dev-guide#2039)
Arbitrary path expressions aren't allowed here (in particular, the path can't rely on another
use
statement).